<template>
  <div class="header-info">
    <div class="list-item-setting">
      <div class="title-info">
        <el-divider content-position="left">头部设置</el-divider>
      </div>
      <el-form-item label="区域高度">
        <el-input-number
            :min="0"
            size="small"
            v-model="optionsInfo['areaHeight']"
        />
      </el-form-item>

      <template v-if="optionsInfo['replenishArea']">
        <el-form-item class="replenish-shown" label="补充说明显示">
          <el-switch v-model="optionsInfo.replenishShown"/>
        </el-form-item>
        <el-form-item class="replenish-shown" label="补充说明内容" v-if="(optionsInfo.replenishShown)">
          <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="optionsInfo.replenishContent" placeholder="请输入内容" size="small"/>
        </el-form-item>
      </template>

      <template v-if="optionsInfo['deptArea']">
        <el-form-item label="序号显示">
          <el-switch v-model="optionsInfo['roomNumberShown']"/>
        </el-form-item>
        <el-form-item class="replenish-shown" label="序号">
          <el-input-number
              :min="1"
              :max="499"
              size="small"
              v-model="optionsInfo['roomNumber']"
          />
        </el-form-item>
        <el-form-item class="replenish-shown" label="序号字号">
          <el-input-number
              :min="1"
              size="small"
              v-model="optionsInfo['roomFontSize']"
          />
        </el-form-item>
        <el-form-item class="replenish-shown" label="科室">
          <el-input v-model="optionsInfo['dept']" placeholder="请输入内容" size="small"/>
        </el-form-item>
        <el-form-item class="replenish-shown" label="科室字号">
          <el-input-number
              :min="1"
              size="small"
              v-model="optionsInfo['deptFontSize']"
          />
        </el-form-item>
      </template>

      <template v-if="optionsInfo['deptNameArea']">
        <el-form-item label="自动获取诊室">
          <el-switch v-model="optionsInfo['deptNameAuto']"/>
        </el-form-item>
        <el-form-item label="诊室名称" v-if="optionsInfo['deptNameAuto']">
          <el-input
              size="small"
              v-model="optionsInfo['deptName']"
          />
        </el-form-item>
      </template>


    </div>
  </div>
</template>

<script>
export default {
  name: "windowConfig-editor",
  componentName: "windowConfig-editor",
  mixins: [],
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
  },
  inject: ['serverFieldList', 'getDesignerConfig'],
  data() {
    return {
      optionsInfo:Object()
    }
  },

  computed: {},

  methods: {},


  watch: {
    // 组件的所有信息
    optionModel: {
      handler: function (val) {
        if(!Reflect.has(val[val.config],'deptName')){
          Reflect.set(val[val.config],'deptName','采血处')
        }
        if(!Reflect.has(val[val.config],'deptNameAuto')){
          Reflect.set(val[val.config],'deptNameAuto',true)
        }
        this.optionsInfo = val[val.config];
      },
      deep: true,
      immediate: true
    }
  }

}
</script>


<style lang="scss" scoped>
.replenish-shown{
  display: flex;
  flex-direction: column;
  :deep(label){
    width: 100% !important;
  }
  :deep(.el-form-item__content){
    margin-left: 0 !important;
  }
}
</style>
